Partitioning for delayed queues in a distributed network

ABSTRACT

A timer service receives timer creation requests from clients and fires those timers upon their expiration by returning to the requesting clients payloads provided with the timer creation requests. A timer creation request includes a client identifier, a timer expiration time, and a payload. The timer service queues timer creation requests, a creation worker adds timer records to a timer store in response to requests and manages partitions of the timer store, and sweeper workers, one per partition, sweep timers into a second queue. A firing worker reads timer index records from the second queue, determines the timers referenced in those timer index records and executes the payloads of those timers. The timer store can be tiered, with partitions different storage priorities based on the timer expirations of the timers in the partitions.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. application Ser. No.15/209,520 filed Jul. 13, 2016, now U.S. Pat. No. 10,228,979, entitled“Dynamic Virtual Partitioning for Delayed Queues,” which is acontinuation of U.S. application Ser. No. 14/619,855 filed on Feb. 11,2015, now U.S. Pat. No. 9,424,075, entitled “Dynamic VirtualPartitioning for Delayed Queues,” which claims the benefit of U.S.Provisional Application No. 62/110,441, filed on Jan. 30, 2015, entitled“Dynamic Virtual Partitioning for Delayed Queues,” the contents of whichare incorporated by reference herein in their entirety.

BACKGROUND

The use of network computing and storage has proliferated in recentyears. The resources for network computing and storage are oftenprovided by computing resource providers who leverage large-scalenetworks of computers, servers and storage drives to enable clients tohost and execute a variety of applications and web services. Clients whotraditionally used on-site servers and storage equipment often forgoon-site hosting and storage and turn to using the resources of thecomputing resource providers.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments in accordance with the present disclosure will bedescribed with reference to the drawings, in which:

FIG. 1 illustrates an example of a timer service.

FIG. 2 illustrates record structures as might be used for tables in atimer store.

FIG. 3 is a swim diagram of various interactions for intake of a timercreation request.

FIG. 4 is a swim diagram of various interactions for creating timerrecords from incoming timer requests.

FIG. 5 is a swim diagram of various interactions for a firing process.

FIG. 6 illustrates an aspect of dynamic virtual partitioning.

FIG. 7 illustrates an environment in which various embodiments can beimplemented.

FIG. 8 is a schematic block diagram of a host that might be used in atimer service.

DETAILED DESCRIPTION

In the following description, various embodiments will be described. Forpurposes of explanation, specific configurations and details are setforth in order to provide a thorough understanding of the embodiments.However, it will also be apparent to one skilled in the art that theembodiments may be practiced without the specific details. Furthermore,well-known features may be omitted or simplified in order not to obscurethe embodiment being described.

Techniques described and suggested herein include methods, systems, andprocesses for managing timers. A timer is a simple computing construct.A software program, client, computer system, etc., might use a timer tocause some action to occur at a defined future time (e.g., the timer's“expiration” time). The timer typically has a defined payload and thatpayload is sent or executed at the defined future time. The definedfuture time is typically defined in the timer or timer request. A timerserver or system that manages these timers will track the expirationtimes and at or about the expiration time for a given timer, the timerserver or system will “fire” the timer, e.g., by sending or executingthat timer's payload. The payload may be as simple as “send thispredefined message to the client that set the timer” or more complex andmay involve performing some computation and sending some data to adestination other than the program, client, computer system, etc. thatset the timer. In cases where a client requests cancellation of a timer,it may be that the timer remains in the timer service, but its payloadis flagged so that it does not execute.

As one example, a data maintenance program might set a timer thatexpires at midnight at the end of the day such that at midnight, thetimer “fires” or initiates a backup of some computer system. The timerexpiration time might be expressible in a number of ways, relative orabsolute, such as “20 minutes after the timer is created”, “midnight onthe last day of this month”, 12:34 pm on May 2, 2015, or the like.Another timer might be set by gift card distribution software that sendsan e-mail and updates a user profile with a credit, as might be set by agift giver desiring that a gift recipient be informed, and receive, anonline gift card and have that timer fire at midnight on the date of thegift recipient's birthday. This is useful where the gift giver wouldlike to make arrangements in advance and knows the defined future timethat the gift giver would like the event to occur. In that case, thegift giver would, in advance, set a timer for giving the gift and, atthe defined future time (midnight on the date of the gift recipient'sbirthday, in this example), the timer would fire, triggering the actionspecified by the payload, namely, to send the e-mail and update the userprofile.

When the timer service is provided by a computing resource provider, thecomputing resource provider might provide its clients with an ability tocreate timers, maintain those timers and then fire a timer action whenthe timer reaches its conclusion. There are a number of possiblecongestion points with providing a timer service for a large number ofclients.

A timer can be represented by a data structure that contains anidentification of the client that set the timer, an identification ofthe expiration time/date of the timer, and an identification of theaction to be taken when the timer is “fired” at expiration. In one suchtimer service, a client can create a timer by sending a timer creationmessage to the computing resource provider. The timer creation messagemight contain a payload and an expiration time. A distributed computingsystem managed by the computing resource provider would then, at orabout the expiration time send the payload back to the client thatcreated the timer. This is referred to herein as “firing” the timer. Thedistributed computing system might delete the timer after firing ormight not delete the timer, however the distributed computing systemwill maintain some record of the timer from creation to firing.

In the general case, a timer is created with a timer expiration time andan indication of the action that is to occur when the timer is fired (atthat timer expiration time). A timer creation request can be in the formof a message, data structure, API call, or the like, where the timercreation request includes the parameters of the timer and/or referencesto those parameters. Different timer services might have differentformats for timer creation requests, but typically a timer creationrequest would reference the client making the request, a timerexpiration time, and the action to be taken at the timer expirationtime.

The particular action taken in response to the timer firing can begeneralized to emitting a payload that was provided to the timer servicewith the request for timer creation. In a typical operation, a clientsubmits a request to create a timer, including with that request aclient identifier (if one is not already known to the timer service fromother contexts), a specification of a timer expiration time, and apayload to be returned to the requesting client when the timer fires.Some timers might be repeating timers (e.g., timers that expire at theend of each hour), but such repeating timers might just be treated asmultiple timers that each fire only once without interfering with theunderstanding of the teachings herein. The payload might be empty, inwhich case the response to the timer firing might simply be a messagesent to the client to signal that the timer has fired. In other cases,the payload is data that the requesting client is storing with the timerand is passing that data forward to that requesting client in thefuture. In some cases, it might be that the requesting client and therecipient of the payload are distinct, but that should be understood asa straightforward variation of what is described herein.

In the general case, a payload might be represented by a data structureprovided to the timer service when a client sets a timer with the timerservice. It may be that the structure of the payload is totally opaqueto the timer service and all the timer service knows is that it wasprovided with payload data and the timer service is expected, at thefiring time of the timer, to send the payload data to some destination,which might be the client or some other destination, such as a networklocation, queue, etc. specified in the timer request. In other cases,there might be some processing that the timer service does with thepayload data, in which case, perhaps not all of the payload is opaque tothe timer service. In examples herein, executing a payload is whathappens upon a timer firing and executing that payload could involvesending one or more messages to one or more destinations, performingoperations at the timer service or controlled by the timer service, orsome other action defined by the payload.

Clients may expect to have the payloads of timers they set executed in atimely manner. If a client specifies that a timer is to fire (and as aresult, its payload to be executed) at Time T, the timer service shouldfire the timer at Time T, not before and not after. Some time period ofnonzero duration might be considered an acceptable equivalent to Time T,such as T+/−1 millisecond. What constitutes “timely manner” might bedefined by the timer creation request, a service level agreement, orsome other method.

A reliable timer service will accept timer creation requests, not losethe timers, and execute the payloads in a timely manner upon firing.With a large number of clients, not all of which are predictable inbehavior, the reliable timer service should be able to scale up anddown. As an example, a service level agreement might specify thatpayloads that comprise sending a message will be executed within +/−1second of the requested expiration time for the timer. A client mightspecify a jitter period of 20 seconds, in which case a timer would betimely if it is fired and a payload executed between the requestedexpiration time and 20 seconds after the requested expiration time.Timely manner includes firing timers not too late, but also includes notfiring them too soon.

The timer service might be implemented by networked computers, storagesystems, and communications paths. Potential congestion points mightinvolve incoming timer creation requests, firing timers, and storinglong-lived timers. Some actions by clients might involve one, two, orall of these congestion points. For example, some clients have a veryhigh, bursty timer creation rate but well distributed firing times.Scaling for those clients might only require scaling up the intakecapacity. Some clients might have a steady timer creation rate but becreating timers with firing times highly concentrated around a specifictime period, in which case the timer service might not need to addresources to intake capacity, but just to firing capacity. Some clientsmight create many timers that are short-lived timers, so the timers comeand go quickly, while other clients might create long-lived timers, inwhich case demand for timer storage would increase even for steady timercreation rates and steady timer firing rates.

A timer service might be provided by a cloud computing resourceprovider. In a typical cloud computing environment, clients requestresources from a cloud computing service. Those services might includean allocation of computing power, storage, communication, or otherfunctions. The client requests might be in the form of API calls to aserver, where the server might reply with an acknowledgement and triggerallocation of the resources. Since the resources are often available foruse by many clients, inefficient use of resources may result in lostrevenue or usability. As a result, efficient use of shared resources isoften a goal of providers of such computing environments. In the case ofthe timer service, the timer service can be more efficient if it canindependently scale along the different dimensions rather than justscaling up capacity in all directions when more capacity is needed intimer creation, timer firing, or timer storage.

A timer service can be used as part of a delayed queuing service. Usingthe timer service, a client can implement a queue that the client canplace a payload onto with the assurance that it will emit from the queueat a specified future time. In many of the examples here, the payload isdescribed as being emitted to the client that requested creation of thetimer, but the payload can flow from one system or instance to anothersystem or instance, after the specified delay using a number ofmechanisms, implemented at the client or the timer service. For example,the client might be set up to route any received timer payloads to theirultimate destination or the timer service could be set up to include adestination in the timer creation request that is distinct from theclient identifier of the request. In other variations, the timer servicemight maintain a mapping of destinations by client. Whether the timerservice is used as a timer service directly or as a distributed queueingsystem that manages delayed queues, there are a few challenges. One ishow to scale for timer or queue item creation. Another is how to scalefor timer firing or queue item processing/delivery. Another is how toefficiently store and process the requests between creation andcompletion/firing. Some aspects of timer systems that meet thesechallenges are presented in the figures.

FIG. 1 illustrates an example of a timer service. In that figure,various components are shown as blocks with interconnecting pathways.The components might be implemented on dedicated hardware, logicallyallocated among other tasks being performed by hardware, or beimplemented entirely on software running on some hardware platform. Forexample, some or all of the components illustrated in FIG. 1 might beimplemented on a web service that provides resizable compute capacity inthe cloud such as Amazon's EC2 web service. Therefore, it should beunderstood that the blocks might be physical blocks or programs runningin a processor space and the pathways might be logical computingcommunications or messaging pathways implemented in software.

As shown, the timer service has an input to receive requests to createtimers such as request 102. These requests might be in the form of data,messages, API calls or other methods of communicating requests. A timerservice front-end 104 might be the endpoint recipient for theserequests. Request 102 can include an indication of the client making therequest, the timer expiration time (in relative or absolute terms), anda payload, as explained below.

Upon receipt of request 102, timer service front-end 104 consults aclient configuration store 106 to obtain details for operationsinvolving some clients. Client configuration store 106 might containdata indicating, for some clients, their stated throughput requirements.For example, a client might have previously sent a message to the timerservice or some other cloud computing component to indicate that theclient would only be making ten transactions per second with the timerservice. The client might be billed or allocated resources accordinglyand the timer service front-end 104 can choose to throttle, reject oraccept timer creation requests based on the number of timers actuallybeing requested. In some implementations, no throttling occurs and inothers, throttling only occurs when timer service front-end 104 beginsto get overloaded with requests.

Timer service front-end 104 might also check whether a requested timeralready exists, so that in a reply to the requesting client, the timerservice front-end 104 can indicate that the timer already exists. Timerservice front-end 104 might also manage metrics such as the creationrate of each client, to facilitate adding alarms or otherwise dealingwith creation rate relative to requested transactions per second(“TPS”). Timer service front-end 104 might also be able to handle intakeof timer creation requests when other parts of the timer service aredown or performing poorly.

Timer service front-end 104 is coupled to an intake queue 108 wheretimer creation requests are placed and used first-in, first-out, oraccording to another queuing scheme. A creation worker 110 takes a timercreation request off intake queue 108 and generates a timer record 112for the removed timer creation request and updates a timer index record(or creates a new one). The timer record might simply be a copy of thetimer creation request if it is already in suitable form. Variations aredescribed in further detail below. Creation worker 110 stores timerrecord 112 into timer store 114 and might repeat this process many timesuntil intake queue 108 is empty.

Timer store 114 might be in the form of a distributed key-value pairdatabase with support for strong consistency and using a primary/entitykey and discriminator framework. The timer records stored in timer store114 can be allocated to virtual partitions. These can be in addition tohard partitions of a database that is used for timer store 114. Aplurality 116 of sweeper workers 118 monitors timer store 114 toidentify timer index records that are expiring timer index records. Anexpiring timer index record is a timer index record that containsreferences to timers that are about to expire. Timers that are about toexpire are timers represented by timer records with expiration times(specified expiration times or scheduled expiration times; thedifference is explained below) slightly before a current time. Howslightly before a current time an expiration time needs to be do cause atimer record to be identified by the sweeper workers can depend onconfiguration settings set by the timer service. Evaluation might bedone by evaluating a current time and comparing it to the expirationtime of the timers, as indicated in the timer records.

Sweeper workers 118 might be in the form of sweeper worker processesexecuted by some computer hardware. As used herein, “process” as in“sweeper worker process”, “creation worker process”, etc., might referto a software unit that is invoked by an operating system or the like sothat the software unit executes and performs the functionality sought.For example, a sweeper worker process might be embodied in softwareinstructions that run in a loop while executing to sweep timer indexrecords from a virtual partition and perform other functions. Suchsoftware processes can be invoked, started, stopped, and deleted.

When a sweeper worker identifies such a timer index record thatreferences timers that are reaching their expiration times, that sweeperworker adds that timer index record to a swept queue 120. As explainedin more detail below, the number of sweeper workers 118 might be set sothat there is one sweeper worker process for each virtual partition oftimer store 114. New virtual partitions might be created by creationworker processes as they detect that existing virtual partitions arenearing capacity. Other methods of creating virtual partitions aredescribed herein, such as based on scaling schedules anticipating futureneeds for virtual partitions. Each virtual partition might be a unit oflogical division in a storage node that supports the timer store andsupports prefix key queries, in a strongly-consistent data store.

As sweeper workers sweep the timer index records and after havingenqueued them to the swept queue, the sweeper workers will mark thosetimer index records as having been swept/processed. The sweeper workerswill also set a time-to-live (“TTL”) value for those records, so that alater garbage collection process will automatically purged those timerindex records at some point. A primary sweeper worker might miss a timerindex due to some local congestion or a sweeper worker failure. Theprimary sweeper worker can be programmed to continue moving forwardthrough the timer index records even if some might have been missed. Inthat case, a stale sweeper worker might run a little behind the time ofa primary sweeper worker to sweep up timer index records that areskipped or missed by primary sweeper workers. This helps ensure thateach timer gets fired at least once.

A firing worker 122 takes timer index records off of swept queue 120,and for each timer index record, sends the payloads of that timer indexrecord's timer records to the destination 130 identified in those timerrecords, executes the payloads, or some variation. Firing worker 122might send a payload to a notification service or queuing service thatis tasked with reliably getting that payload back to the client or tothe destination that the client specified when creating the timerrecord. For example, destination 130 for the payloads might be an AmazonSimple Notification Service (“SNS”) queue or an Amazon Simple QueueService (“SQS”) instance. Other destinations are possible and they neednot be identical to the client that initiated the timer. Firing worker122 might execute multiple payloads as a group, such as when there areseveral payloads that are directed to one destination.

A sweeper worker preferably deals with a timer index record at some timebefore the expiration times of the timers referenced in that timer indexrecord, so that the firing worker is able to execute the payload of atimer at its expiration time. The criteria that the sweeper worker usesto evaluate when a timer is reaching its expiration time may depend onhow the sweeper worker is configured. For example, if a primary sweeperworker reviews its assigned timer index records once per minute, failureand reinstantation of the primary sweeper takes two minutes at most, andthe stale sweeper worker executes with a time that is five minutesbehind the primary sweeper worker, then the sweeper workers might movetimer index records to the swept queue at least six minutes before theexpiration times of timers in those timer index records. That way, timerindex records will reach the swept queue before the expiration time ofthe timers referenced in those timer index records even if the primarysweeper worker fails. The timer service might have a configuration filethat specifies what constitutes nearing expiration and/or that criteriathat a sweeper worker is to use in evaluating timer index records fornearing expiration.

Some of the components shown in FIG. 1 might use existing structures.For example, intake queue 108 and swept queue 120 might be implementedusing Amazon Simple Queue Service (“SQS”) instances. A lock controller126 and a sweeper worker coordinator 124 might be used to providedistributed locking services and to manage the sweeper workers,respectively. Lock controller 126 might maintain the locks in a locksdatabase 128 that is a strongly-consistent database.

FIG. 2 illustrates record structures as might be used for tables intimer store 114. As illustrated there, in one example, there are fourtables: a timers table, a timers index table, a sweeper checkpointstable, and a client configuration table. A record in the timers tablemight have the fields shown by example data structure 202, a record inthe timers index table might have the fields shown by example datastructure 204, the sweeper checkpoints table might have the fields shownby example data structure 206, and the client configuration table mighthave the fields shown by example data structure 208.

Data structure 202 has fields for a ClientID, a ClientTimerID, aCreationTime, an ExpireTime, a ScheduledTime, a FiredTime, and aPayload. This might be used as the data structure for a timer record.The ClientTimerID might be a unique identifier provided by the client,so that the client can match up returned payloads with timer creationrequests made. In some variations, the CreationTime might not beincluded as a field. The entity key for the timers table might beClientID+ClientTimerID. In some variations, there are separate datastructures for long-lived timers and short-lived timers. The dividinglength for the two might be set by a configuration file. For example, aconfiguration file might specify that long-lived is greater than onehour and short-lived is less than one hour. The ExpireTime might be aspecified time specified by the client. The ScheduledTime might be atime calculated from the ExpireTime and a jitter delay, representing avariance on the expiration time that is acceptable to the client. Thejitter period might be specified by the client as an acceptablevariation of the expiration time. For example, a client might specify anExpireTime of 2015 Dec. 25 12:00 AM PST and specify a jitter of 5minutes. In that case, the ScheduledTime might be anywhere between 12:00AM and 12:05 AM and still satisfy the clients' requested delivery time.The FiredTime is set after the timer is actually fired and is the actualtime of firing. A quality monitoring process and/or an alarm process canmonitor the differences between ScheduledTime and FiredTime to takeappropriate actions.

Data structure 204 has fields for a VirtualPartitionNumber, aTimePeriod, a Discriminator, a TimerList, and a SweptState. This mightbe used as the data structure for a timer index record. The TimePeriodmight be a pointer to a time period that has a predefined granularity,such as a pointer to a specific second with the granularity being onesecond, so that a record might relate to a group of timers that allexpire within that one second period. The TimePeriod might also be madeup of a start time and a stop time of a period. The TimerList is a listof identifiers of the timers that are indexed in that timers index tablerecord. The TimerList might be a list of timer references by entity key(e.g., ClientID+ClientTimerID). The SweptState can be a binary valuefrom the set {0, 1} where “0” indicates that the timer index record (andby extension, the set of timers referenced in TimerList) has not yetbeen swept into the swept queue and “1” indicates that it has.

The records in the timers index table have a Discriminator field. Thediscriminator might be a decreasing index that allows for prefixsearches to quickly identify the next available index number. The valueof the discriminator might start at some predefined high-watermarkvalue. Then, if a timer index record is already full and a new one needsto be added with the same entity key, its discriminator value would bedecremented by one. Since the list of records that share the same entitykey are sorted in increasing lexicographical order, retrieving the firstone would instantly indicate how many records there are under that sameentity key.

The entity key for the timers index table might beVirtualPartitionNumber and TimePeriod. In some implementations,VirtualPartitionNumber and TimePeriod are not separate fields, but aconcatenation is used to make up a single value for the entity key. Toalleviate the case of there being a hot spot during creation and firing,virtual partitions can be used to spread the requests across availablepartitions. Each index record might be modeled as a discriminator,essentially returning each index entity key as a list (of indexrecords). Note that by aggregating timer references for those timersthat are due to fire at the same time into the same index record, thissimplifies handling large index records and allows for fewerdiscriminator records per entity.

Data structure 206 has fields for a SweeperID and a timestamp. TheSweeperID might be a VirtualPartitionNumber where there is one sweeperworker instance per virtual partition. The timestamp might be in UTC.The entity key for the sweeper checkpoints table can be the SweeperID.Sweeper checkpoints are useful for managing stale sweeper workers thatpick up timer index records that other sweeper workers might have missedor skipped to avoid falling behind.

Data structure 208 has fields for ClientID, DestinationType,MaxDaysInFuture, and JitterRange. The entity key for this data structureis the ClientID and this data structure can be used for storingclient-specific values. The ClientID might be a 32-character string thatidentifies a client to the timer service. The DestinationType fieldmight be a byte that identifies the destination type of client and/ortimer requests that come from that client. The MaxDaysInFuture fieldrepresents a client-specific setting that governs how far in the futurea particular client is allowed to create timers for, which might be usedto account for resource constraints and to reduce possible abuse. TheJitterRange is the amount of allowed variation between the client'sstated expiration time and its scheduled time, as explained elsewhereherein.

Using the data structures of FIG. 2 and the components of FIG. 1, atimer service can field timers in a flexible manner. By using multiplesweeper workers, the work needed to fire off the expiring timers can bedistributed. The timer service can automatically manage theup/down-scaling of processing capacity of queue items by dynamicallycontrolling virtual partitions.

The virtual partitions might be distributed over many hosts and thosehosts might have varying storage structures. Those storage structuresmight also have varying priorities, speeds, capacities, and storagecosts. Some virtual partitions might be higher priority (hot-store) andsome lower priority (cold-store). Lower priority virtual partitionsmight be used to hold timer index records for timers with expirationtimes in the far future and higher priority virtual partitions might beused to hold timer index records for timers with expiration times in thenear future. It may be that the timer service maintains a priorityexpiration value that divides far future expiration times from nearfuture expiration times and the creation worker uses that priorityexpiration value in part to determine which virtual partition to use.

FIGS. 3-7 are swim diagrams illustrating various flows betweencomponents such as those shown in FIG. 1. A timer service might beinitialized to have some pre-defined number of virtual partitions tostart with. In some of the figures, only one sweeper worker isindicated, but it should be understood that there may be many similarlyoperating sweeper workers.

FIG. 3 is a swim diagram of various interactions for intake of a timercreation request. The components interacting are a client, thefront-end, databases, and the intake queue. The client can be anyprogram, system, instantiation, or the like that is attempting to createa timer to be managed by the timer service. The front-end is at theinput of the timer service and might be in the form of a web-enabled APIinterface or other construction that allows it to receive requests fromclients. The databases might comprise one database management systemthat handles multiple tables or stores, such as client configurationstore 106 and timer store 114 shown in FIG. 1.

The timer creation process begins with a client making a “create timer”call to the front-end with a Timer data structure as an argument of thecall. The Timer data structure might be like data structure 202 shown inFIG. 2. When the front-end receives the call, it can extract a clientidentifier ClientID from the Timer data structure. The front-end wouldthen get client details using ClientID. Those details can come fromcached records at the front-end or, optionally if the records are notcached, using a getKey(ClientID) call to a database such as a clientconfiguration store and the front-end could cache those details. If thedetails indicate that the client is not authorized to create timers, orif the client record does not exist, the front-end can return anexception to the client.

To avoid duplicates, the front-end can issue a getKey(ClientID_TimerID)call to a store such as timer store 114 and look at the response todetermine if a timer with that TimerID already exists for that ClientID.If so, the front-end can return an exception to the client. However, ifthat is not the case, the front-end can apply a jitter to the timer andsend the Timer data structure as a message to the intake queue. If theintake queue response with an acknowledgement, the front-end can assumethat the process is complete and inform the client that the timer wascreated. The jitter is useful for firing a large number of timers over awider period while still complying with client requirements in caseswhere the exact time of firing is not critical to the client.

If the timer store or the client configuration store are down orreturning any exceptions, the front-end might still enqueue the timercreation request to the intake queue and send an acknowledgement to theclient. Some error messages or alarms might be emitted. If the intakequeue is down or returning any exceptions, the front-end will fail therequest back to the client.

FIG. 4 is a swim diagram of various interactions for creating timerrecords from incoming timer requests. The components interacting are acreation worker, a task executor, a worker thread, the intake queue, andthe timer store. The timer record creation process begins with thecreation worker requesting a batch of timer creation requests from theintake queue. This can be done using batch API calls and LongPolling (toincrease retrieval efficiency and reduce cost). Since the front-end putsthe requests onto the intake queue and the creation worker takesrequests from the intake queue and can do so without needing to be insync, congestion at the front-end will not spill over to the creationworker and congestion at the creation worker will not backlog thefront-end (unless the intake queue overflows, but that can be avoided).The intake queue responds with a batch of messages, but those messagesremain in the intake queue at this point.

The creation worker then delegates to a number of worker threads via aThreadExecutor and each worker thread creates its assigned timer recordin Timers scope as well as creating and updating a timer index recordfor the timers in the TimersIndex scope. The timer index record might becreated and managed by (1) determining the virtual partition under whichthe timer index record should belong and (2) reading the target timerindex record based on the virtual partition and expiration time of thetimer. If the target timer index record does not exist, one can becreated with the TimersIndex scope, or if it already exists, the workerthread will append a reference to the existing record.

In some cases, placing the timer record into the timer store can be doneusing a conditional put, and if that fails, repeat from step 1 aboveafter a backoff retry, as illustrated in FIG. 4. If the timer record issuccessfully placed into the timer store, then the worker thread cantell the intake queue to delete that timer creation request.

If the intake queue is down or returning any exceptions to the creationworker's batch requests, calls, timer creation requests would not belost, but this condition might trigger a log entry and an alarm. If theintake queue is down or returning any exceptions to requests to deletemessages, those timer creation requests will be made visible again atsome point and might cause increased number of duplicate index recordreferences if this is sustained in a short period of time, but otherwisemight not need any special handling.

If the timer store is down, the error might be logged and the workerthread will not proceed further. The message will be made visible againby the intake queue after a visibility timeout period. If the timerstore is returning non-retryable exceptions, the error might be loggedand the worker thread will not proceed further. This type of exception(other than the conditional put failure), should hopefully be rare, butif/when it occurs an immediate alarm might be triggered. Where the timerstore is returning retryable exceptions, the worker thread can justbackoff retry up to a certain number of time, after which the treatmentis the same as above.

If the timer store returns conditional put exceptions for timers, noaction need be taken. This might happen if the timer index recordcreation/update fails or if there are extreme number of duplicaterequests in a short period of time. The backoff retry may deal withthose cases.

If the ThreadExecutor's backing queue is full, the main thread will beblocked. If this persists long enough, messages will be made visibleagain by the intake queue after a visibility timeout period and couldcause increased number of duplicate index record references. This can beaccounted for when choosing the visibility timeout period.

The sweeper workers and sweeper worker coordinator can be managed usinga worker-coordinator structure. In that structure, the sweeper workercoordinator controls assignments for sweeper workers and sweeper workerscan be added as needed. This can be done using a lock manager,membership store, and assignment store. The sweeper worker coordinatorhandles group membership of the sweeper worker hosts. This can be basedon monitoring the sessions established by those hosts using a watchersystem. The sweeper worker coordinator handles assigning virtualpartitions to sweeper worker hosts based on a “least number of virtualpartitions” process and in case of ties, a simple random choice can beused for the tie-breaker. The assignment of virtual partitions are doneby writing a value corresponding to the virtual partition number to theappropriate sweeper worker entry, which in turn corresponds to and isbeing monitored by a sweeper worker host. Redundancy for the coordinatorcan be handled by having multiple hosts vying for the same lock. Thesweeper worker coordinator should have the same information as thecreation worker in terms of how many virtual partitions there are. Thiscan be configured statically via a shared configuration file or it canbe dynamic.

Even if the lock manager is down or membership cannot be detected, ifthere is no churn in the existing active sweeper worker hosts, theneverything should continue to work fine. If there is some churn, thenthere may be unassigned virtual partitions from the sweeper worker hoststhat went down during the outage. Eventually when the lock manager comesback up, the stale sweeper workers of those virtual partitions will pickup any missed timers and get them to the swept queue in time for afiring worker to get to those timers. Unassigned virtual partitions canbe alarmed. If returning locks to multiple coordinators, if all virtualpartitions have been assigned and there is no churn in existing activesweeper worker hosts, then in theory there should be no impact. Duringany sweeper worker hosts transition, there might be multiple assignmentsfor the same virtual partitions (as different coordinators may come upwith a different conclusion in terms of who gets what, whichever writesthe last wins). As long as there is a sweeper worker per virtualpartition, this should not cause problems.

Each sweeper worker could use a watch function to watch for an entrycorresponding to that sweeper's host in the assignment store. Once thesweeper worker coordinator writes to that entry, that serves as theofficial assignment of that host for a given virtual partition. Thesweeper workers will then read the timer index records based on thevirtual partition assigned to them and the current time, and enqueue anyunprocessed timer index record chunks to the swept queue. The timerindex records in the swept queue will ultimately be processed by thefiring workers. The sweeper worker also updates records as having beenprocessed. A stale sweeper worker will follow behind the current time,from the last checkpoint time, enqueue any unprocessed index records itfinds, and progress its checkpoint time.

FIG. 5 is a swim diagram of various interactions for a firing process.The components interacting are a firing worker, the swept queue, thetimer store, and a destination queue. The destination queue might be anAmazon simple query service (“SQS”) instantiation. A firing workerreceives batches of timer index records enqueued by the sweeper workersand fires the payloads of the timers referenced in those timer recordsto the destination queues of those timers. The destinations for thepayloads might be distinct from the clients that created timers andprovided those payloads. Once messages are sent to the destinationqueue, the firing worker can request that the timer index record bedeleted from the swept queue. This can be done by having the timerrecords marked as having been fired and their TTL set for automaticpurging.

FIG. 6 illustrates an aspect of dynamic virtual partitioning. Theconfigurations described above may cover most cases provided that enoughvirtual partitions are allocated to spread the load of timers firing.This can be done either up front as the base number of virtualpartitions, or it can be done just before on-boarding a new client withhigh throughput requirements. Virtual partitions can also be added asneeded by the creation worker process.

Where there is a “hotspot” in one or more of the virtual partitions fora particular time period, there might be an extreme number ofdiscriminator records under the same virtual partition index recordentity key in the timer store, which could slow down the sweeperworkers, thus lowering the firing throughput and, in the worst case,cause the timer service to miss its firing service level agreement(“SLA”).

This can be dealt with by automatically scaling the sweeping and firingthroughput using dynamic virtual partitioning. When processing a timercreation request, the creation worker process knows upon reading thefirst record for a timer index key approximately how many discriminatorrecords (and by proxy, the number of timers) currently exist for thattimer index key (by way of the tail attribute, which is monotonicallyincreasing). If the creation worker detects that a maximum number ofrecords is being approached beyond which maintaining the averagethroughput would be difficult, it can decide to increase the number ofvirtual partitions, which should then trigger instantiation ofadditional sweeper workers for the new virtual partitions. Instantiationmight be performed by requesting that an operating system allocateresources for the additional sweeper workers, load program code forthose additional sweeper workers into program memory of a processor, andthen start the program code executing.

In some variations, the creation worker or the sweeper workercoordinator is designated the authority on the number of virtualpartitions that are present. For example, the creation worker could senda message to the sweeper worker coordinator, which will then update avirtual partitioning configuration file read by both, in addition topotentially kicking off other things such as launching additional ACChosts.

The increased number of virtual partitions may not necessarily andconsistently be needed at all times (for example, midnight period may bemore popular than others), and it would be a waste of resources toalways scale up to the maximum level. To account for this, a scalingschedule might be used that would provide information about how manyvirtual partitions are needed at any given time. A data model for thescaling schedule might include an entity key, one record that is thedefault record that indicates base number of virtual partitions, and oneor more keys for various period identifiers (where the period can beweeks, months as necessary), to serves as kind of an override record tothe default. A granularity might be provided for the scaling schedule.

Each virtual partition might be configurable in various ways, such as aconfiguration to limit the number of things that can be assigned to thatvirtual partition at any given time. These configurations can be madevary based on the needs and/or the physical host specification thatbacks the virtual partitions, and might include the maximum number ofrecords, where a record is an aggregation of queue items, and themaximum number of items per record.

When the creation worker creates a timer record and creates or updates atimer index record, the creation worker determines which virtualpartition to assign the timer record to. This assignment could berandom, round-robin, based on the timer expiration time, or somecombination of these or other factors. In some instances, it might bedesirable to aggregate timers with similar expiration times into onevirtual partition, while in other instances it might be desirable todistribute such timers over different virtual partitions.

When the creation worker determines that an additional virtual partitionmight be needed, it can trigger the creation of that virtual partition.One way to do that is by assignment of keys to records. This might be ona keying scheme in which a key comprises a virtual partition ID, a timefor when the queue item is to be processed and an integer representingthe max number of records. Each of the parts is in turn separated bysome delimiter. So for example, the first record that is assigned tovirtual partition A and scheduled to be processed at time T1 and wherethe max number of records is 100 and with delimiter being _(underscore)would have key A_T1_100. The records per virtual partition are thenordered in increasing lexicographical order. So for example, a recordwith key A_T1_099 would appear before a record with key A_T1_100. Thecreation worker can query the virtual partition based on the prefix A_T1(using the above example) for the first record that matches that prefix.The result of this operation instantaneously informs the creation workerthe state of the virtual partition in terms the number of records (andby implications, an approximate number of items) for that virtualpartition without having to look through the entire timer store. This isdue to the key scheme and ordering mechanism.

When storing a timer record, if there is no record returned, thecreation worker can store the item using the key from the query. If arecord is returned, check if the number of items per record exceeds asetting. If not, the item can be stored using the key. If yes, it willcheck whether the third part of the key is greater than zero and if so,it will then construct a new key with the third part of the key beingthe prior key decremented by 1. So for example, if the prior key wasA_Ti_099, a new key of A_T1_098 would be created.

If that does not work, then this particular virtual partition isconsidered exhausted. There are a couple of options at this point, whichis to start the process all over again by randomly picking a differentvirtual partition, or dynamically create new ones. In practice, eitherof these steps likely should be taken before a virtual partition isfully exhausted and so some buffer that is determined to be safe can beestablished as an early warning mechanism.

For dynamic virtual partitioning, a scaling schedule is created, whichcontains a default number of virtual partitions that are used at asteady state and a list of overrides corresponding to the specific timeswhere the number of virtual partitions need to be increased. Theoverride for the scaling schedule can be specified when the systemthinks a virtual partition may be at risk of being exhausted soon. Thesystem would then periodically scan the scaling schedule and for anyoverrides that are coming up soon (per some criteria that it uses todetermine that), it would then automatically scale-up various parts ofthe system to be able to process the items due per the override period.

This might be done by launching new hosts for the additional virtualpartitions and assigning them to specific partitions. The timer servicewould know when upcoming hot-spot periods will arrive and when thingswill be back to the steady state. After the hot-spot periods, the timerservice can deprovision the additional capacity that it launched inorder to prevent idle resources and wasted cost. The virtual partitionsmight be distributed over a plurality of physical hosts.

FIG. 7 illustrates aspects of an example environment 700 forimplementing aspects in accordance with various embodiments. As will beappreciated, although a web-based environment is used for purposes ofexplanation, different environments may be used, as appropriate, toimplement various embodiments. The environment includes an electronicclient device 702, which can include any appropriate device operable tosend and/or receive requests, messages or information over anappropriate network 704 and, in some embodiments, convey informationback to a user of the device. Examples of such client devices includepersonal computers, cell phones, handheld messaging devices, laptopcomputers, tablet computers, set-top boxes, personal data assistants,embedded computer systems, electronic book readers and the like. Thenetwork can include any appropriate network, including an intranet, theInternet, a cellular network, a local area network, a satellite networkor any other such network and/or combination thereof. Components usedfor such a system can depend at least in part upon the type of networkand/or environment selected. Protocols and components for communicatingvia such a network are well known and will not be discussed herein indetail. Communication over the network can be enabled by wired orwireless connections and combinations thereof. In this example, thenetwork includes the Internet, as the environment includes a web server706 for receiving requests and serving content in response thereto,although for other networks an alternative device serving a similarpurpose could be used as would be apparent to one of ordinary skill inthe art.

The illustrative environment includes at least one application server708 and a data store 710. It should be understood that there can beseveral application servers, layers or other elements, processes orcomponents, which may be chained or otherwise configured, which caninteract to perform tasks such as obtaining data from an appropriatedata store. Servers, as used herein, may be implemented in various ways,such as hardware devices or virtual computer systems. In some contexts,servers may refer to a programming module being executed on a computersystem. As used herein, unless otherwise stated or clear from context,the term “data store” refers to any device or combination of devicescapable of storing, accessing and retrieving data, which may include anycombination and number of data servers, databases, data storage devicesand data storage media, in any standard, distributed, virtual orclustered environment. The application server can include anyappropriate hardware, software and firmware for integrating with thedata store as needed to execute aspects of one or more applications forthe client device, handling some or all of the data access and businesslogic for an application. The application server may provide accesscontrol services in cooperation with the data store and is able togenerate content including, but not limited to, text, graphics, audio,video and/or other content usable to be provided to the user, which maybe served to the user by the web server in the form of HyperText MarkupLanguage (“HTML”), Extensible Markup Language (“XML”), JavaScript,Cascading Style Sheets (“CSS”) or another appropriate client-sidestructured language. Content transferred to a client device may beprocessed by the client device to provide the content in one or moreforms including, but not limited to, forms that are perceptible to theuser audibly, visually and/or through other senses including touch,taste, and/or smell. The handling of all requests and responses, as wellas the delivery of content between the client device 702 and theapplication server 708, can be handled by the web server using PHP:Hypertext Preprocessor (“PHP”), Python, Ruby, Perl, Java, HTML, XML oranother appropriate server-side structured language in this example. Itshould be understood that the web and application servers are notrequired and are merely example components, as structured code discussedherein can be executed on any appropriate device or host machine asdiscussed elsewhere herein. Further, operations described herein asbeing performed by a single device may, unless otherwise clear fromcontext, be performed collectively by multiple devices, which may form adistributed and/or virtual system.

The data store 710 can include several separate data tables, databases,data documents, dynamic data storage schemes and/or other data storagemechanisms and media for storing data relating to a particular aspect ofthe present disclosure. For example, the data store illustrated mayinclude mechanisms for storing production data 712 and user information716, which can be used to serve content for the production side. Thedata store also is shown to include a mechanism for storing log data714, which can be used for reporting, analysis or other such purposes.It should be understood that there can be many other aspects that mayneed to be stored in the data store, such as page image information andaccess rights information, which can be stored in any of the abovelisted mechanisms as appropriate or in additional mechanisms in the datastore 710. The data store 710 is operable, through logic associatedtherewith, to receive instructions from the application server 708 andobtain, update or otherwise process data in response thereto. Theapplication server 708 may provide static, dynamic or a combination ofstatic and dynamic data in response to the received instructions.Dynamic data, such as data used in web logs (blogs), shoppingapplications, news services and other such applications may be generatedby server-side structured languages as described herein or may beprovided by a content management system (“CMS”) operating on, or underthe control of, the application server. In one example, a user, througha device operated by the user, might submit a search request for acertain type of item. In this case, the data store might access the userinformation to verify the identity of the user and can access thecatalog detail information to obtain information about items of thattype. The information then can be returned to the user, such as in aresults listing on a web page that the user is able to view via abrowser on the user device 702. Information for a particular item ofinterest can be viewed in a dedicated page or window of the browser. Itshould be noted, however, that embodiments of the present disclosure arenot necessarily limited to the context of web pages, but may be moregenerally applicable to processing requests in general, where therequests are not necessarily requests for content.

Each server typically will include an operating system that providesexecutable program instructions for the general administration andoperation of that server and typically will include a computer-readablestorage medium (e.g., a hard disk, random access memory, read onlymemory, etc.) storing instructions that, when executed by a processor ofthe server, allow the server to perform its intended functions. Suitableimplementations for the operating system and general functionality ofthe servers are known or commercially available and are readilyimplemented by persons having ordinary skill in the art, particularly inlight of the disclosure herein.

The environment, in one embodiment, is a distributed and/or virtualcomputing environment utilizing several computer systems and componentsthat are interconnected via communication links, using one or morecomputer networks or direct connections. However, it will be appreciatedby those of ordinary skill in the art that such a system could operateequally well in a system having fewer or a greater number of componentsthan are illustrated in FIG. 7. Thus, the depiction of the system 700 inFIG. 7 should be taken as being illustrative in nature and not limitingto the scope of the disclosure.

FIG. 8 is a schematic block diagram of a host 802 that might be used inimplementing various elements described above. Host 802 can be used as ahost for timer service front-end 104, creation worker 110, sweeperworkers 118, sweeper worker coordinator 124, firing worker 122, supportfor computer programs that perform other functions, or the like.

Host 802 may include one or more processors (processor(s)) 814, one ormore memory devices 816 (generically referred to herein as memory 816),one or more input/output (“I/O”) interface(s) 818, one or more networkinterfaces 820, and data storage 824. Host 802 may further include oneor more buses 822 that functionally couple various components of host802. Bus(es) 822 may include at least one of a system bus, a memory bus,an address bus, or a message bus, and may permit exchange of information(e.g., data (including computer-executable code), signaling, etc.)between various components of host 802.

Memory 816 may include volatile memory (memory that maintains its statewhen supplied with power) such as random access memory (RAM) and/ornon-volatile memory (memory that maintains its state even when notsupplied with power) such as read-only memory (ROM), flash memory,ferroelectric RAM (FRAM), and so forth. In certain example embodiments,volatile memory may enable faster read/write access than non-volatilememory. However, in certain other example embodiments, certain types ofnon-volatile memory (e.g., FRAM) may enable faster read/write accessthan certain types of volatile memory.

Data storage 824 may include removable storage and/or non-removablestorage including, but not limited to, magnetic storage, optical diskstorage, and/or tape storage. Data storage 824 may provide non-volatilestorage of computer-executable instructions and other data. Data storage824 may store computer-executable code, instructions, or the like thatmay be loadable into memory 816 and executable by processor(s) 814 tocause processor(s) 814 to perform or initiate various operations. Datastorage 824 may additionally store data that may be copied to memory 816for use by processor(s) 814 during the execution of thecomputer-executable instructions. Moreover, output data generated as aresult of execution of the computer-executable instructions byprocessor(s) 814 may be stored initially in memory 816, and mayultimately be copied to data storage 824 for non-volatile storage.Examples of data that might be stored in memory 816 or data storage 824include local caches of data store information for data externallystored.

Data storage 824 may store one or more operating systems (O/S) 826; oneor more database management systems (DBMS) 828; and one or more programmodules, applications, or the like. Any of the program modules mayinclude one or more sub-modules. Any of the modules depicted in FIG. 8may include computer-executable code, instructions, or the like that maybe loaded into memory 816 for execution by one or more of processor(s)814.

Processor(s) 814 may be configured to access memory 816 and executecomputer-executable instructions loaded therein. For example,processor(s) 814 may be configured to execute computer-executableinstructions of the various program modules of host 802 to cause orfacilitate various operations to be performed.

One or more input/output (I/O) interfaces 818 may be provided that mayfacilitate the receipt of input information by host 802 from one or moreI/O devices as well as the output of information from host 802 to theone or more I/O devices. The I/O devices may include, for example, oneor more user interface devices that facilitate interaction between auser and host 802 including, but not limited to, a display, a keypad, apointing device, a control panel, a touch screen display, a remotecontrol device, a microphone, a speaker, and so forth. The I/O devicesmay further include, for example, any number of peripheral devices suchas data storage devices, printing devices, and so forth.

Host 802 may further include one or more network interfaces 820 viawhich host 802 may communicate with any of a variety of other systems,platforms, networks, devices, and so forth. Such communication may occurvia any of one or more of network(s) 812.

It should be appreciated that the program modules, applications,computer-executable instructions, code, or the like depicted in FIG. 8as being stored in data storage 824 and data storage 846 are merelyillustrative and not exhaustive and that processing described as beingsupported by any particular module may alternatively be distributedacross multiple modules or performed by a different module. In addition,various program module(s), script(s), plug-in(s), ApplicationProgramming Interface(s) (API(s)), or any other suitablecomputer-executable code hosted locally on host 802. Further,functionality may be modularized differently such that processingdescribed as being supported collectively by the collection of programmodules depicted in FIG. 8 may be performed by a fewer or greater numberof modules, or functionality described as being supported by anyparticular module may be supported, at least in part, by another module.In addition, any of the functionality described as being supported byany of the program modules depicted in FIG. 8 may be implemented, atleast partially, in hardware and/or firmware across any number ofdevices.

The various embodiments further can be implemented in a wide variety ofoperating environments, which in some cases can include one or more usercomputers, computing devices or processing devices which can be used tooperate any of a number of applications. User or client devices caninclude any of a number of general purpose personal computers, such asdesktop, laptop or tablet computers running a standard operating system,as well as cellular, wireless and handheld devices running mobilesoftware and capable of supporting a number of networking and messagingprotocols. Such a system also can include a number of workstationsrunning any of a variety of commercially-available operating systems andother known applications for purposes such as development and databasemanagement. These devices also can include other electronic devices,such as dummy terminals, thin-clients, gaming systems and other devicescapable of communicating via a network. These devices also can includevirtual devices such as virtual machines, hypervisors and other virtualdevices capable of communicating via a network.

Various embodiments of the present disclosure utilize at least onenetwork that would be familiar to those skilled in the art forsupporting communications using any of a variety ofcommercially-available protocols, such as Transmission ControlProtocol/Internet Protocol (“TCP/IP”), User Datagram Protocol (“UDP”),protocols operating in various layers of the Open System Interconnection(“OSI”) model, File Transfer Protocol (“FTP”), Universal Plug and Play(“UpnP”), Network File System (“NFS”), Common Internet File System(“CIFS”) and AppleTalk. The network can be, for example, a local areanetwork, a wide-area network, a virtual private network, the Internet,an intranet, an extranet, a public switched telephone network, aninfrared network, a wireless network, a satellite network and anycombination thereof.

In embodiments utilizing a web server, the web server can run any of avariety of server or mid-tier applications, including Hypertext TransferProtocol (“HTTP”) servers, FTP servers, Common Gateway Interface (“CGI”)servers, data servers, Java servers, Apache servers and businessapplication servers. The server(s) also may be capable of executingprograms or scripts in response to requests from user devices, such asby executing one or more web applications that may be implemented as oneor more scripts or programs written in any programming language, such asJava®, C, C# or C++, or any scripting language, such as Ruby, PHP, Perl,Python or TCL, as well as combinations thereof. The server(s) may alsoinclude database servers, including without limitation thosecommercially available from Oracle®, Microsoft®, Sybase® and IBM® aswell as open-source servers such as MySQL, Postgres, SQLite, MongoDB,and any other server capable of storing, retrieving and accessingstructured or unstructured data. Database servers may includetable-based servers, document-based servers, unstructured servers,relational servers, non-relational servers or combinations of theseand/or other database servers.

The environment can include a variety of data stores and other memoryand storage media as discussed above. These can reside in a variety oflocations, such as on a storage medium local to (and/or resident in) oneor more of the computers or remote from any or all of the computersacross the network. In a particular set of embodiments, the informationmay reside in a storage-area network (“SAN”) familiar to those skilledin the art. Similarly, any necessary files for performing the functionsattributed to the computers, servers or other network devices may bestored locally and/or remotely, as appropriate. Where a system includescomputerized devices, each such device can include hardware elementsthat may be electrically coupled via a bus, the elements including, forexample, at least one central processing unit (“CPU” or “processor”), atleast one input device (e.g., a mouse, keyboard, controller, touchscreen or keypad) and at least one output device (e.g., a displaydevice, printer or speaker). Such a system may also include one or morestorage devices, such as disk drives, optical storage devices andsolid-state storage devices such as random access memory (“RAM”) orread-only memory (“ROM”), as well as removable media devices, memorycards, flash cards, etc.

Such devices also can include a computer-readable storage media reader,a communications device (e.g., a modem, a network card (wireless orwired), an infrared communication device, etc.) and working memory asdescribed above. The computer-readable storage media reader can beconnected with, or configured to receive, a computer-readable storagemedium, representing remote, local, fixed and/or removable storagedevices as well as storage media for temporarily and/or more permanentlycontaining, storing, transmitting and retrieving computer-readableinformation. The system and various devices also typically will includea number of software applications, modules, services or other elementslocated within at least one working memory device, including anoperating system and application programs, such as a client applicationor web browser. It should be appreciated that alternate embodiments mayhave numerous variations from that described above. For example,customized hardware might also be used and/or particular elements mightbe implemented in hardware, software (including portable software, suchas applets) or both. Further, connection to other computing devices suchas network input/output devices may be employed.

Storage media and computer readable media for containing code, orportions of code, can include any appropriate media known or used in theart, including storage media and communication media, such as, but notlimited to, volatile and non-volatile, removable and non-removable mediaimplemented in any method or technology for storage and/or transmissionof information such as computer readable instructions, data structures,program modules or other data, including RAM, ROM, Electrically ErasableProgrammable Read-Only Memory (“EEPROM”), flash memory or other memorytechnology, Compact Disc Read-Only Memory (“CD-ROM”), digital versatiledisk (DVD) or other optical storage, magnetic cassettes, magnetic tape,magnetic disk storage or other magnetic storage devices or any othermedium which can be used to store the desired information and which canbe accessed by the system device. Based on the disclosure and teachingsprovided herein, a person of ordinary skill in the art will appreciateother ways and/or methods to implement the various embodiments.

The specification and drawings are, accordingly, to be regarded in anillustrative rather than a restrictive sense. It will, however, beevident that various modifications and changes may be made thereuntowithout departing from the broader spirit and scope of the invention asset forth in the claims.

Other variations are within the spirit of the present disclosure. Thus,while the disclosed techniques are susceptible to various modificationsand alternative constructions, certain illustrated embodiments thereofare shown in the drawings and have been described above in detail. Itshould be understood, however, that there is no intention to limit theinvention to the specific form or forms disclosed, but on the contrary,the intention is to cover all modifications, alternative constructionsand equivalents falling within the spirit and scope of the invention, asdefined in the appended claims.

The use of the terms “a” and “an” and “the” and similar referents in thecontext of describing the disclosed embodiments (especially in thecontext of the following claims) are to be construed to cover both thesingular and the plural, unless otherwise indicated herein or clearlycontradicted by context. The terms “comprising,” “having,” “including”and “containing” are to be construed as open-ended terms (i.e., meaning“including, but not limited to,”) unless otherwise noted. The term“connected,” when unmodified and referring to physical connections, isto be construed as partly or wholly contained within, attached to orjoined together, even if there is something intervening. Recitation ofranges of values herein are merely intended to serve as a shorthandmethod of referring individually to each separate value falling withinthe range, unless otherwise indicated herein and each separate value isincorporated into the specification as if it were individually recitedherein. The use of the term “set” (e.g., “a set of items”) or “subset”unless otherwise noted or contradicted by context, is to be construed asa nonempty collection comprising one or more members. Further, unlessotherwise noted or contradicted by context, the term “subset” of acorresponding set does not necessarily denote a proper subset of thecorresponding set, but the subset and the corresponding set may beequal.

Conjunctive language, such as phrases of the form “at least one of A, B,and C,” or “at least one of A, B and C,” unless specifically statedotherwise or otherwise clearly contradicted by context, is otherwiseunderstood with the context as used in general to present that an item,term, etc., may be either A or B or C, or any nonempty subset of the setof A and B and C. For instance, in the illustrative example of a sethaving three members, the conjunctive phrases “at least one of A, B, andC” and “at least one of A, B and C” refer to any of the following sets:{A}, {B}, {C}, {A, B}, {A, C}, {B, C}, {A, B, C}. Thus, such conjunctivelanguage is not generally intended to imply that certain embodimentsrequire at least one of A, at least one of B and at least one of C eachto be present.

Operations of processes described herein can be performed in anysuitable order unless otherwise indicated herein or otherwise clearlycontradicted by context. Processes described herein (or variationsand/or combinations thereof) may be performed under the control of oneor more computer systems configured with executable instructions and maybe implemented as code (e.g., executable instructions, one or morecomputer programs or one or more applications) executing collectively onone or more processors, by hardware or combinations thereof. The codemay be stored on a computer-readable storage medium, for example, in theform of a computer program comprising a plurality of instructionsexecutable by one or more processors. The computer-readable storagemedium may be non-transitory.

The use of any and all examples, or exemplary language (e.g., “such as”)provided herein, is intended merely to better illuminate embodiments ofthe invention and does not pose a limitation on the scope of theinvention unless otherwise claimed. No language in the specificationshould be construed as indicating any non-claimed element as essentialto the practice of the invention.

Embodiments of this disclosure are described herein, including the bestmode known to the inventors for carrying out the invention. Variationsof those embodiments may become apparent to those of ordinary skill inthe art upon reading the foregoing description. The inventors expectskilled artisans to employ such variations as appropriate and theinventors intend for embodiments of the present disclosure to bepracticed otherwise than as specifically described herein. Accordingly,the scope of the present disclosure includes all modifications andequivalents of the subject matter recited in the claims appended heretoas permitted by applicable law. Moreover, any combination of theabove-described elements in all possible variations thereof isencompassed by the scope of the present disclosure unless otherwiseindicated herein or otherwise clearly contradicted by context.

All references, including publications, patent applications and patents,cited herein are hereby incorporated by reference to the same extent asif each reference were individually and specifically indicated to beincorporated by reference and were set forth in its entirety herein.

What is claimed is:
 1. A computer-implemented method for managing atimer service, comprising: receiving timer creation requests fromclients, wherein a first timer creation request of the timer creationrequests references a timer expiration time for a first timer and apayload for the first timer, wherein the payload indicates an actionthat a first client requests to be performed at or after the timerexpiration time, and wherein clients are requesters of resources from acloud computing service that is providing the timer service to aplurality of clients; forming a timer record from the first timercreation request, the timer record associated with a first clientidentifier indicating the first client, the timer expiration time andthe payload; and causing the payload of the timer record to be executedupon expiration of the timer expiration time.
 2. Thecomputer-implemented method of claim 1, further comprising selectingtimer records referencing timers with expiration times that include atimer expiration time of the timers associated with the timer records.3. The computer-implemented method of claim 1, further comprisingremoving a plurality of timers as a unit if the timers of the pluralityof timers have payloads with destinations in common with other timers ofthe plurality of timers.
 4. A system, comprising: one or more processorsand one or more memory devices; the one or more processors executing aninput interface stored in the one or more memory devices for receiving afirst timer creation request from a first client for a first timer,wherein the first timer creation request references a first timerexpiration time for the first timer and a payload for the first timer,wherein the payload references an action that the first client requeststo be performed on or after the first timer expiration time, and whereinthe first client is a client of a plurality of clients that arerequesters of resources from a cloud computing service that is operatingthe system and providing a timer service to the plurality of clients; atimer store; the one or more processors executing a creation workerstored in the one or more memory devices for processing received timercreation requests to form a first timer record for the first timercreation request in the timer store, the first timer record comprisingthe a first client identifier, a first timer expiration time, and anindication of the payload; and the one or more processors executing afirst sweeper worker stored in the one or more memory devices thatevaluates the first timer record to determine that the first timerrecord is an expiring timer record.
 5. The system of claim 4, whereinthe time store comprises storage for a jitter period specified by theclient as an acceptable variation within which the action that the firstclient requests to be performed on or after the first timer expirationtime can be timely performed, and the system further comprising: afiring worker that fires timers referenced in the expiring timer recordby processing payloads of fired timers and executing payloads of thefired timers on their first timer expiration time or within theirassociated jitter period after their first timer expiration time.
 6. Thesystem of claim 4, the system further comprising: a firing worker thatfires timers referenced in the expiring timer record by processingpayloads of fired timers and executing payloads of the fired timers. 7.The system of claim 4, further comprising: a first memory for storing aclient-stated throughput requirement; and a timer front-end processorcapable of reading the first memory and throttling timer creationrequests that exceed the client-stated throughput requirement.
 8. Thesystem of claim 4, further comprising: a first memory for storing ascaling schedule comprising scaling anticipation records, wherein ascaling anticipation record is associated with a scaling period andindicates a number of partition instances, of a plurality of partitioninstances of the timer store, to be allocated for that scaling period;and an interface to the first memory over which the creation workerreads scaling anticipation records.
 9. The system of claim 4, whereintimer records include an indication that, for a given timer record,executing the payload is to be skipped in response to a creating clientrequesting deletion of that given timer record.
 10. The system of claim4, wherein the timer store is arranged comprising a plurality ofpartition instances with a first partition instance having a higherstorage priority and a second partition instance having a lower storagepriority, wherein expiration times of timers referenced in timer recordsin the first partition instance are earlier than the expiration times oftimers referenced in timer records in the second partition instance. 11.The system of claim 10, wherein the first partition instance comprises ahot-store partition instance and the second partition instance comprisesa cold-store partition instance, the hot-store partition instance havingstored timer records with timer expirations that are sooner than apredetermined priority expiration value and the cold-store partitioninstance having stored timer records with timer expirations that arelater than the predetermined priority expiration value.
 12. The systemof claim 4, wherein the first sweeper worker includes a first indicationindicating whether the first sweeper worker is current in its processingof timer expirations and a second indication indicating a checkpointtime of last processing of the first sweeper worker.
 13. Acomputer-implemented method for managing a timer service, comprising:receiving a first timer creation request from a client for creating atimer, wherein the first timer creation request includes a clientidentifier of the client, a timer expiration time for the timer, and apayload of the timer; forming a first timer record from the first timercreation request, the first timer record including at least arepresentation of the client identifier, a first representation of thetimer expiration time, and a second representation of the payload,wherein a rate of forming timer records from timer creation requests isindependent of a rate of receiving timer creation requests from clients;comparing a time period field of the first timer record to a currenttime, using a sweeper worker; and configuring the first timer record forexecution wherein the configuring is done at a first time before a startof a second time indicated by the time period field.
 14. Thecomputer-implemented method of claim 13, further comprising:coordinating operations of a plurality of sweeper workers; and firingtimers referenced in the first timer record, using a firing worker, toexecute payloads of the timers referenced by the first timer record. 15.The computer-implemented method of claim 13, further comprising:maintaining a listing of client-stated throughput requirements based onprior messages from clients indicating their respective throughputrequirements for timer services; and limiting timer creation requestsfrom a given client to that given client's stated throughputrequirement.
 16. The computer-implemented method of claim 13, furthercomprising: using a creation worker to add the first timer creationrequest to a first queue; removing the first timer creation request fromthe first queue, wherein a rate of removing timer creation requests fromthe first queue is independent of a rate of adding timer creationrequests to the first queue; maintaining a scaling schedule comprisingscaling anticipation records, wherein a scaling anticipation record isassociated with a scaling period and indicates a number of partitioninstances, of a timer store comprising a plurality of partitioninstances, to be allocated for that scaling period; reading the scalingschedule using the creation worker; and creating additional partitioninstances based on the scaling schedule.
 17. The computer-implementedmethod of claim 13, further comprising: receiving a client request fordeletion of a given timer record; and modifying the given timer recordto include an indication that executing the payload for that given timerrecord is to be skipped.
 18. The computer-implemented method of claim13, further comprising: arranging a plurality of partition instances ofa timer store comprising a first partition instance and a secondpartition instance; determining a target partition instance to beassociated with the first timer record; storing the first timer recordin the target partition instance; setting the target partition instanceto the first partition instance for timers having expiration timesearlier than a predetermined priority expiration value; and setting thetarget partition instance to the second partition instance for timershaving expiration times later than the predetermined priority expirationvalue.
 19. The computer-implemented method of claim 13, furthercomprising: including, with the sweeper worker, a first indicationindicating whether the sweeper worker is current in its processing oftimer expirations and a second indication indicating a checkpoint timeof last processing of the sweeper worker.
 20. The computer-implementedmethod of claim 13, further comprising: determining a target partitioninstance to be associated with the first timer record; storing the firsttimer record in the target partition instance; determining a first timeperiod for the target partition instance; comparing the first timeperiod to an expiration time of the timer; and selecting as the targetpartition instance a partition instance with a second time period thatincludes the expiration time of the timer.